if(TARGET tensorflow_cc::tensorflow_cc)
	return()
endif()

add_library(tensorflow_cc::tensorflow_cc STATIC IMPORTED GLOBAL)

# Compute the installation prefix from this tensorflow-cc-config.cmake file location.
# CMAKE_CURRENT_LIST_DIR = [vcpkg_installed_dir]/[target_triplet]/share/tensorflow-cc
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]/share
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${TENSORFLOW_INSTALL_PREFIX}" DIRECTORY)
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]

target_include_directories(tensorflow_cc::tensorflow_cc
	INTERFACE
		"${TENSORFLOW_INSTALL_PREFIX}/include/tensorflow-external"
		"${TENSORFLOW_INSTALL_PREFIX}/include/tensorflow-external/src"
)

if(@TENSORFLOW_HAS_RELEASE@)
	set_property(TARGET tensorflow_cc::tensorflow_cc
		PROPERTY IMPORTED_LOCATION
			"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_LIB_NAME@"
	)

	set_property(TARGET tensorflow_cc::tensorflow_cc
		APPEND PROPERTY IMPORTED_CONFIGURATIONS
			RELEASE
	)

	set_property(TARGET tensorflow_cc::tensorflow_cc
		PROPERTY IMPORTED_LOCATION_RELEASE
			"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_LIB_NAME@"
	)
endif()

if(@TENSORFLOW_HAS_DEBUG@)
	if(NOT @TENSORFLOW_HAS_RELEASE@)
		set_property(TARGET tensorflow_cc::tensorflow_cc
			PROPERTY IMPORTED_LOCATION
				"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_LIB_NAME@"
		)
	endif()
	
	set_property(TARGET tensorflow_cc::tensorflow_cc
		APPEND PROPERTY IMPORTED_CONFIGURATIONS
			DEBUG
	)

	set_property(TARGET tensorflow_cc::tensorflow_cc
		PROPERTY IMPORTED_LOCATION_DEBUG
			"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_LIB_NAME@"
	)
endif()

set(tensorflow_cc_FOUND TRUE)
